echo " Installing EmberJS and Apache2."
echo " Please be patient..."
echo -e "\e[00;36m-------------------------------------------------------------------------------\e[00m"
echo ""

# Install Apache2 and SQLite
tce-load -wi expat2.tcz
tce-load -wi apr.tcz
tce-load -wi apr-util.tcz
tce-load -wi ncurses-common.tcz
tce-load -wi ncurses.tcz
tce-load -wi readline.tcz
tce-load -wi liblzma.tcz
tce-load -wi apr-util.tcz
tce-load -wi pcre.tcz
tce-load -wi openssl-1.0.0.tcz
tce-load -wi curl.tcz
tce-load -wi Xlibs.tcz
tce-load -wi libxml2.tcz
tce-load -wi libmcrypt.tcz
tce-load -wi gmp.tcz
tce-load -wi bsddb.tcz
tce-load -wi gdbm.tcz
tce-load -wi libltdl.tcz
tce-load -wi libiconv.tcz
tce-load -wi bzip2-lib.tcz
tce-load -wi sqlite3.tcz
tce-load -wi apache2.tcz

#Required fiddling to have everything accessible from /home/tc/jsdocs (where the persistence is set) whitout modifying the apache conf file
ln -s /usr/local/apache2/htdocs /home/tc/jsdocs

#Install EmberJS
cd /home/tc/jsdocs
wget https://github.com/emberjs/starter-kit/archive/v1.1.2.zip
unzip starter-kit-1.0.0.zip
cd starter-kit-1.0.0
mv -f * ../

#Install JQuery
cd /home/tc/jsdocs
wget http://code.jquery.com/jquery-1.10.2.js

sudo /usr/local/bin/apachectl -k start

# Setting up persistence
echo "home/tc/jsdocs" >> /opt/.filetool.lst
echo "usr/local/apache2/htdocs" >> /opt/.filetool.lst
echo "usr/local/apache2/conf/httpd.conf" >>/opt/.filetool.lst
echo "usr/local/apache2/conf/httpd-vhosts.conf" >>/opt/.filetool.lst

# Backup
filetool.sh -b >> /dev/null
exit

